﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
 
using System.IO;
using BOHVote.Entity;

namespace BOH.Information
{
    public partial class ApplyImport : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void butUploadFile_Click(object sender, EventArgs e)
        {
            HttpFileCollection hfc = Request.Files;
            string FileFullPath = string.Empty;
            for (int i = 0; i < hfc.Count; i++)
            {
                string FileControlName = hfc.Keys[i].ToString();
                if (!string.IsNullOrEmpty(FileControlName) && FileControlName == "fileUploadApply")
                { 
                    HttpPostedFile hpf = hfc[i];
                    if (hpf.ContentLength > 0)
                    {
                        FileFullPath = Server.MapPath("UploadFile") + "\\" + ((BHUser)Session["User"]).UserID+"_"+System.IO.Path.GetFileName(hpf.FileName);
                        if (File.Exists(FileFullPath))
                        {
                            File.Delete(FileFullPath);
                        }
                        hpf.SaveAs(FileFullPath);
                    }
                }
            }
            if (File.Exists(FileFullPath))
            { 

            }
        }
    }
}
